<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button id="boxred">red</button>
		<button id="boxpink">pink</button>
		<button id="boxyellow">yellow</button>
	</body>
	<script>
		// var boxboxy=document.body;
		// console.log(boxboxy);
		
		var boxred=document.getElementById("boxred");
		var boxpink=document.getElementById("boxpink");
		var boxyellow=document.getElementById("boxyellow");
		
		 function changeBgc(bgc){//形参
			document.body.style.backgroundColor=bgc;
		 }
		
		boxred.onclick=function(){
			changeBgc('red');//实参
		}
		boxpink.onclick=function(){
			changeBgc('pink');
		}
		boxyellow.onclick=function(){
			changeBgc('yellow');
		}
	</script>
</html>
